package com.atues.service.impl;

import com.atues.domain.ResponseResult;
import com.atues.domain.SystemConstants;
import com.atues.domain.vo.LinkVo;
import com.atues.utils.BeanCopyUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atues.mapper.LinkMapper;
import com.atues.domain.entity.Link;
import com.atues.service.LinkService;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 友链(Link)表服务实现类
 *
 * @author Liqun
 * @since 2024-09-06 09:47:36
 */
@Service
public class LinkServiceImpl extends ServiceImpl<LinkMapper, Link> implements LinkService {

    @Override
    public ResponseResult getAllLink() {
        LambdaQueryWrapper<Link> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Link::getStatus, SystemConstants.LINK_STATUS_NORMAL);

        List<Link> list = list(wrapper);
        List<LinkVo> linkVos = BeanCopyUtils.copyBeanList(list, LinkVo.class);

        return ResponseResult.okResult(linkVos);


    }
}

